#ifndef _OH_POLICY_ACCESS_H
#define _OH_POLICY_ACCESS_H

#include <oh/base.h>

_OH_BEGIN
_OH_POLICY_BEGIN

// TODO:
// problem here : Read<int, float *>
// user who writes this is a dickhead moron
namespace access{
    template<typename Storage>
    class AccessDetector
    {
        AccessDetector();
    public:
        typedef typename Storage::stored stored;
    };
    template<typename Stored>
    class AccessDetector<Stored *>
    {
        AccessDetector();
    public:
        typedef Stored stored;
    };

    // Const
    template<typename Storage>
    class Read
    {
    public:
        typedef typename AccessDetector<Storage>::stored stored;
        typedef stored const * pointer;
        typedef stored const & reference;
        
        static stored const& Gain (Storage const& a_Where)
        {
            return *const_cast<stored const*const>(&*a_Where);
        }

    // Service stuff
    protected:
        Read( );
    };

    // Non Const
    template<typename Storage>
    class Modify
        : public Read<Storage>
    {
    public:
        typedef typename AccessDetector<Storage>::stored stored;
        typedef stored * pointer;
        typedef stored & reference;

        static stored & Gain (Storage const & a_Where)
        {
            return *const_cast<stored *const>(&*a_Where);
        }

    // Service stuff
    protected:
        Modify( );
    };
}

_OH_POLICY_END
_OH_END

#endif // _OH_POLICY_ACCESS_H